import store from 'store' ;

const storage = {
  setUserInfo:function(userInfo){
    store.set("userInfo" , JSON.stringify(userInfo)  );
  },
  getUserInfo:function () {
    return store.get("userInfo")?JSON.parse(store.get("userInfo")):{} ;
  },
  setAccessToken:function(accessToken){
    store.set("accessToken" , accessToken );
  },
  getAccessToken:function () {
    return store.get("accessToken");
  },
  removeAccessToken:function(){
    store.remove('accessToken')
  },
  removeRemember:function(){
    store.remove('remember')
  },
  setRemember:function(userInfo){
    store.set("remember" ,JSON.stringify(userInfo)  );
  },
  getRemember:function(){
    return store.get('remember')?JSON.parse(store.get('remember')) : {}
  },
  setCurrentUserInfo:function(userInfo){
    store.set("currentUserInfo" ,JSON.stringify(userInfo)  );
  },
  getCurrentUserInfo:function(){
    return store.get('currentUserInfo')?JSON.parse(store.get('currentUserInfo')) : {}
  },
  removeCurrentUserInfo:function(){
    store.remove('currentUserInfo')
  },
  setAccount:function(account){
    store.set("account" ,account);
  },
  getAccount:function(){
    return store.get('account')
  },
  removeAccount:function(){
    store.remove('account')
  },
}
export default  storage  ;
